<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    body{
        font-family: cursive;
    }
</style>
<body>

<script>
    var sum = prompt("请输入金字塔的行数：");
    for (var i=0;i<sum;i++){
        var nusp = sum-i-1;
        for(var l=0;l<nusp;l++){
            document.write("&nbsp;");
        }
        var a = (i+1)*2-1;
        for(var k=0;k<a;k++){
            document.write("*");
        }
        document.write("<br>");
    }

</script>

</body>
</html>